#ifndef __cmachine__
#define __cmachine__

//#include "celement.h"
#include "celement.h"
class CElement;
class CBuffer;
class CPart;

class CMachine : public CElement {
	CPart* NowPart;
	CPart* PreviousPart;
	int NowOperationType;
	int Status;
	
	void setStatus(int st);
	int machineId;
public:
	
	int getStatus();
	
	void Respond(CEvent* evt);
	bool TryPull();
	bool TryPush();
	double calcSetupTime();
	double calcProcessTime();
	void Process();
	
	bool Pull(CMachine* aM);//从机器处拉得一个零件
	bool Pull(CBuffer* aB);//从缓冲处拉来一个零件
	bool GivePartTo(CMachine* aM);//将零件送到另一个机器
	bool GivePartTo(CBuffer* aB);//将零件送到一个缓冲区
	
	CPart* HandOutPart();//给出零件
	
	CMachine();
	~CMachine();
	
	void setMachineID(int id);
	
	static const int Idle;
	static const int SetingUp;
	static const int Processing;
	static const int Blocked;

};
#endif // __cmachine__
